home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / RELEASE.ZIP / sub_arctic / lib / backdrop.java < prev    next >
Encoding:
Java Source  |  1996-10-04  |  3.1 KB  |  110 lines

  1.  
  2. package sub_arctic.lib;
  3.  
  4. import sub_arctic.output.loaded_image;
  5. import sub_arctic.output.drawable;
  6.  
  7. /** 
  8.  * A simple interactor that just fills its area with a pattern, but
  9.  * otherwise does nothing. 
  10.  *
  11.  * @author Scott Hudson
  12.  */
  13. public class backdrop extends base_interactor {
  14.  
  15.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  16.  
  17.   /** The background pattern that we fill our area with. */
  18.   protected loaded_image _pattern = null;
  19.  
  20.   /** The background pattern that we fill our area with. */
  21.   public loaded_image pattern() {return _pattern;};
  22.  
  23.   /** Set the background pattern */
  24.   public void set_pattern(loaded_image pat)
  25.     {
  26.       if (pat != _pattern)
  27.     {
  28.       _pattern = pat;
  29.       damage_self(); 
  30.     }
  31.     }
  32.  
  33.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  34.  
  35.   /** 
  36.    * Full constructor. 
  37.    * 
  38.    * @param int          xv x position of the area.
  39.    * @param int          yv y position of the area.
  40.    * @param int          wv width of the area.
  41.    * @param int          hv height of the area.
  42.    * @param loaded_image pat the pattern we tile the area with.
  43.    */
  44.   public backdrop(int xv, int yv, int wv, int hv, loaded_image pat)
  45.     {
  46.       super(xv,yv,wv,hv);
  47.       set_pattern(pat);
  48.     }
  49.  
  50.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  51.  
  52.   /** 
  53.    * Constructor assuming default position of 0,0.
  54.    * 
  55.    * @param int          wv width of the area.
  56.    * @param int          hv height of the area.
  57.    * @param loaded_image pat the pattern we tile the area with.
  58.    */
  59.   public backdrop(int wv, int hv, loaded_image pat)
  60.     {
  61.       super(0,0,wv,hv);
  62.       set_pattern(pat);
  63.     }
  64.  
  65.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  66.  
  67.   /** 
  68.    * Constructor assuming default position of 0,0, and (temporary) 
  69.    * default size.  Typically size will be constrained to something. 
  70.    *
  71.    * @param loaded_image pat the pattern we tile the area with.
  72.    */ 
  73.   public backdrop(loaded_image pat)
  74.     {
  75.       super(0,0,64,64);
  76.       set_pattern(pat);
  77.     }
  78.  
  79.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  80.  
  81.   /** 
  82.    * Draw self using pattern fill. 
  83.    * @param drawable d the drawing surface we place our output on. 
  84.    */
  85.   protected void draw_self_local(drawable d)
  86.     {
  87.       if (pattern() != null)
  88.         d.tileImage(pattern(), 0, 0, w()-1, h()-1);
  89.     }
  90.  
  91.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  92.  
  93. }
  94. /*=========================== COPYRIGHT NOTICE ===========================
  95.  
  96. This file is part of the subArctic user interface toolkit.
  97.  
  98. Copyright (c) 1996 Scott Hudson and Ian Smith
  99. All rights reserved.
  100.  
  101. The subArctic system is freely available for most uses under the terms
  102. and conditions described in 
  103.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  104. and appearing in full in the lib/interactor.java source file.
  105.  
  106. The current release and additional information about this software can be 
  107. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  108.  
  109. ========================================================================*/
  110.